1. Field of the Invention
The present invention relates to a method of compiling source code, involving a pre-processing step for including at least one additional source code file into the source code prior to generating target code from the source code.
The present invention also relates to a compiler for compiling source code, the compiler comprising a pre-processor adapted to include at least one additional source code file into the source code prior to generating target code from the source code.
The present invention further relates to a computer system for compiling source code and to a computer program product for use on a computer.
2. Description of the Related Art
Compiling of computer programs, i.e., translating source file text or source code to a predetermined type of target code, typically involves a pre-processing step to include additional text in the form of additional source code files into a main source file text by means of a pre-processor. A well-known example from the C programming language is the pre-processor command #include “include.h” which commands the pre-processor to include additional source file text comprised in the additional source code file “include.h” into the main source file text, which is typically denoted “main.c” in the present example. The additional source code files are also commonly referred to a header files (*.h).
In a general way, the pre-processor allows text manipulations before actual compilation of a source code file. In the present example, the include directive is replaced with a text file, which is usually stored on a local hard disk of the machine compiling the source code.
As known to a person skilled in the art, real world software projects may include up to 100 different files or more. Most of these files are header files from libraries, i.e., collections of sub-programs for software development, wherein the header files define an Application Programming Interface (API) to that particular library by means of function prototypes. For instance, the Xine executable of the heavily used Xine media player on Linux™ is linked against 34 libraries. Xine comprises the xine-ui user interface and a shared library xine-lib packages which currently include a combined number of 390 external header files.
However, APIs generally are not fixed, since the libraries are constantly being developed, i.e. updated to keep up with changing requirements and specifications. This leads to the particular problem that local copies of the above-mentioned header files quickly become outdated. Thus, frequent time-consuming and cumbersome manual updates of header files are required.